import app
import requests


class UserApi:
    def __init__(self):
        self.create_token = app.host_url + "token/user"
        self.check_token = app.host_url + "token/verify"
        self.get_adress = app.host_url + "address"

    def creatApi(self):
        code_data = {"code": app.code}
        return requests.post(url=self.create_token, headers=app.header, json=code_data)

    def checkApi(self):
        data = {"token": app.header.get("token")}
        return requests.post(url=self.check_token, headers=app.header, json=data)

    def getApi(self):
        return requests.get(url=self.get_adress, headers=app.header)
